/*
 *   Copyright (c) 2011 Hitachi Data Systems, Inc.
 *
 *   Permission is hereby granted to  this software and associated
 *   documentation files (the "Software"), subject to the terms and
 *   conditions of the Sample Source Code License (SSCL) delivered
 *   with this Software. If you do not agree to the terms and
 *   conditions of the SSCL,
 *
 *     (i)  you must close this file and delete all copies of the
 *          Software, and
 *     (ii) any permission to use the Software is expressly denied.
 *
 */

package com.hds.hcp.apihelpers.query.request;

/**
 * Class that holds the <code>lastResult</code> data for a query request for performing metadata queries
 * against an HCP storage system. 
 * <p>
 * The <code>lastResult</code> data is used to perform Paged Queries with the HCP Metadata Query Interface.
 * It specifies the last record that was returned by the last page of query content to efficiently
 * identify the cached query for which the next results returned should come from.  Each value must
 * be identical to what was returned by the previous query result.
 * <p>
 * All class members must be set to a value to be considered valid by the metadata query interface.
 * If a data member is not set to a value, it will not be included in the JSON formatted output.
 * <p>
 * The class is constructed as a Bean to facilitate utilizing Jackson JSON 
 * serializer to create JSON formatted requests. The Jackson JSON component
 * will interpret the Bean format and generate JSON string for the object when
 * calling the <code>toString</code> method.
 * 
 * @version 5.0
 *
 */
public class LastResult extends BaseQueryRequest {
	private String _changeTimeMilliseconds;
	private Long _version;
	private String _urlName;
	
	/**
	 * Default Constructor.  All member content is considered unset (null).
	 */
	public LastResult()
	{
		_version = null;
		_changeTimeMilliseconds = null;
		_urlName = null;
	}
	
	/**
	 * Alternative constructor to set all member values to valid content.
	 * 
	 * @param inChangeTimeMilliseconds String representation of the change time of the last object.
	 * @param inObjectURI Full object URI to last object.
	 * @param inVersion HCP version of the last object.
	 */
	public LastResult(String inChangeTimeMilliseconds, String inObjectURI, Long inVersion)
	{
		_changeTimeMilliseconds = new String(inChangeTimeMilliseconds);
		_version = inVersion;
		_urlName = inObjectURI;
	}

	// Getter Methods.
	/**
	 * Getter method for the change time in milliseconds since POSIX Epoch Time (January 1, 1970 UTC). 
	 *
	 * @return HCP specific formatted value in the form of the number of milliseconds followed by a period (.)
	 * and trailing 2 digit number.
	 * <p>
	 * An example format would be: <code>56490884324.00</code>
	 */
	public String getChangeTimeMilliseconds() {
		return _changeTimeMilliseconds;
	}
	
	/**
	 * Getter method for the full URL to the object in the HCP system.
	 * @return A string in the form of a properly constructed HTTP URL.
	 */
	public String getUrlName() {
		return _urlName;
	}
	
	/**
	 * Getter method for the object version as assigned by HCP.
	 * @return Object version as a Long object.
	 */
	public Long getVersion() {
		return _version;
	}
	
	// Setter Methods.
	/**
	 * Setter method for the change time in milliseconds since POSIX Epoch Time (January 1, 1970 UTC). 
	 * <p>
	 * The format is HCP specific and thus a string. The number of millisecond value is followed by a period (.)
	 * and trailing 2 digit number. When providing the value for this function, make sure it is identical to 
	 * the record returned in the previous query result.
	 * <p>
	 * An example value is: <code>592086902432.00"</code>
	 */
	public void setChangeTimeMilliseconds(String inChangeTimeMilliseconds) {
		_changeTimeMilliseconds = inChangeTimeMilliseconds;
	}
	
	/**
	 * Setter method for the full URL to the object in the HCP system.
	 * @param inUrlName Full HCP system URL to the object.
	 * <p>
	 * For example: <code>http://ns1.ten1.hcp1.example.com/rest/datadir1/myfile.doc</code>
	 */
	public void setUrlName(String inUrlName) {
		_urlName = inUrlName;
	}
	
	/**
	 * Setter method for the object version as assigned by HCP.
	 * 
	 * @param inVersion Long object representing the HCP version assigned to the object.
	 */
	public void setVersion(Long inVersion) {
		_version = inVersion;
	}
	
}
